﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:v="clr-namespace:ShredTheLog.Views;assembly=ShredTheLog.Views"
    xmlns:vm="clr-namespace:ShredTheLog.ViewModels;assembly=ShredTheLog.ViewModels"
    xmlns:cnv="clr-namespace:ShredTheLog.Converters;assembly=ShredTheLog.Converters"
    xmlns:c="clr-namespace:ShredTheLog.Controls;assembly=ShredTheLog.Controls"
    >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="OdigoMisc2.xaml"/>
        <ResourceDictionary Source="OdigoImages\CloseTab.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="CloseTabButton" TargetType="{x:Type Button}">
        <Setter Property="Command" Value="{Binding CloseCommand}"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Margin" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <StackPanel Orientation="Vertical">
                        <Border Background="White" HorizontalAlignment="Stretch" Height="3" Opacity="0.01"/>
                        <Border Background="{StaticResource MainTabItemBackgroundBrush}" BorderThickness="1, 0, 1, 1" BorderBrush="Black" Margin="0" Padding="4, 3, 4, 3">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="{StaticResource CloseTabImage}" Width="12" Height="12"/>
                                <TextBlock Text="{c:LocalizedString s_Close}" Margin="5, 0, 0, 0" VerticalAlignment="Center" Foreground="Black"/>
                            </StackPanel>
                        </Border>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="CloseTabPopupStyle" TargetType="{x:Type Popup}">
        <Setter Property="HorizontalOffset" Value="-7"/>
        <Setter Property="VerticalOffset" Value="-2"/>
        <Setter Property="PopupAnimation" Value="None"/>
        <Setter Property="AllowsTransparency" Value="True"/>
        <Setter Property="Margin" Value="0"/>
    </Style>

    <!--Заголовок закладки Home-->
    <DataTemplate DataType="{x:Type vm:HomePageViewModel}">
        <Image Source="OdigoImages\Home.png" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center" ToolTip="{c:LocalizedString s_Home}"/>
    </DataTemplate>

    <!--Заголовок закладки Text Chat-->
    <DataTemplate DataType="{x:Type vm:TextChatViewModel}">
        <StackPanel x:Name="panel" Orientation="Horizontal">
            <Image Source="OdigoImages\RadarTabButton.png" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center" ToolTip="{c:LocalizedString s_TextChat}"/>
            <Popup IsOpen="{Binding ElementName=panel, Path=IsMouseOver, Mode=OneWay}" PlacementTarget="{Binding ElementName=panel}" Style="{StaticResource CloseTabPopupStyle}">
                <Button Style="{StaticResource CloseTabButton}"/>
            </Popup>
        </StackPanel>
    </DataTemplate>

    <!--Заголовок закладки Contacts-->
    <DataTemplate DataType="{x:Type vm:ContactListViewModel}">
        <StackPanel x:Name="panel" Orientation="Horizontal">
            <Image Source="OdigoImages\ContactsTabIcon.png" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center" ToolTip="{c:LocalizedString s_ContactList}"/>
            <Popup IsOpen="{Binding ElementName=panel, Path=IsMouseOver, Mode=OneWay}" PlacementTarget="{Binding ElementName=panel}" Style="{StaticResource CloseTabPopupStyle}">
                <Button Style="{StaticResource CloseTabButton}"/>
            </Popup>
        </StackPanel>
    </DataTemplate>

    <!--Заголовок закладки User Search-->
    <DataTemplate DataType="{x:Type vm:UserSearchViewModel}">
        <StackPanel x:Name="panel" Orientation="Horizontal">
            <Image Source="OdigoImages\UserSearchTabIcon.png" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center" ToolTip="{c:LocalizedString s_Tab_Odigo_UserSearch}"/>
            <Popup IsOpen="{Binding ElementName=panel, Path=IsMouseOver, Mode=OneWay}" PlacementTarget="{Binding ElementName=panel}" Style="{StaticResource CloseTabPopupStyle}">
                <Button Style="{StaticResource CloseTabButton}"/>
            </Popup>
        </StackPanel>
    </DataTemplate>

</ResourceDictionary>